package com.spark.incoicingsi.config;
import com.spark.incoicings.utils.AliOssUtil;
import com.spark.incoicingsi.entity.AliOssProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class OssConfig {
    @Bean
    @ConditionalOnMissingBean
    public AliOssUtil aliOssUtil(AliOssProperties aliOssProperties){

        return new AliOssUtil(aliOssProperties.getOss().getEndpoint(),
                aliOssProperties.getAccessKey(), aliOssProperties.getSecretKey(), aliOssProperties.getOss().getBucketName());
    }
}
